package com.xgggh.binding.data.redpack;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by az on 2018/5/26.
 */

public class RedPack implements Parcelable {
    /**
     * 唯一id
     */
    private String id;
    /**
     * 金额
     */
    private double amount;
    /**
     * 红包类型 1 固定 2 随机 3 免费 4 任务
     */
    private int type;
    /**
     * 红包寄语
     */
    private String story;
    /**
     * 赞助人
     */
    private Player sponsor;
    /**
     * 收割者
     */
    private Player player;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getAmount() {
        return amount;
    }

    public void setAmount(double amount) {
        this.amount = amount;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getStory() {
        return story;
    }

    public void setStory(String story) {
        this.story = story;
    }

    public Player getSponsor() {
        return sponsor;
    }

    public void setSponsor(Player sponsor) {
        this.sponsor = sponsor;
    }

    public Player getPlayer() {
        return player;
    }

    public void setPlayer(Player player) {
        this.player = player;
    }

    public RedPack() {
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeDouble(this.amount);
        dest.writeInt(this.type);
        dest.writeString(this.story);
        dest.writeParcelable(this.sponsor, flags);
        dest.writeParcelable(this.player, flags);
    }

    protected RedPack(Parcel in) {
        this.id = in.readString();
        this.amount = in.readDouble();
        this.type = in.readInt();
        this.story = in.readString();
        this.sponsor = in.readParcelable(Player.class.getClassLoader());
        this.player = in.readParcelable(Player.class.getClassLoader());
    }

    public static final Creator<RedPack> CREATOR = new Creator<RedPack>() {
        @Override
        public RedPack createFromParcel(Parcel source) {
            return new RedPack(source);
        }

        @Override
        public RedPack[] newArray(int size) {
            return new RedPack[size];
        }
    };
}
